<html>
<head>
<title>JAtari</title>

<style type="text/css">
	p, th, input {
		font-family: "verdana", helvetica;
		font-size: 8pt;
	}
	td {
		font-family: "lucida console", monospace;
		font-size: 8pt;
	}
	td.memory {
		text-align: center;
	}
	table {
		border-collapse: collapse;
		empty-cells: show;
	}

</style>

<script type="text/javascript">

function show_memory()
{
	if(document.getElementById('display_memory').checked == true)
		document.getElementById('memory').style.display = 'block';
	else
		document.getElementById('memory').style.display = 'none';
}

function show_cpu()
{
	if(document.getElementById('display_cpu').checked == true)
		document.getElementById('cpu').style.display = 'block';
	else
		document.getElementById('cpu').style.display = 'none';
}

function show_pia()
{
	if(document.getElementById('display_pia').checked == true)
		document.getElementById('pia').style.display = 'block';
	else
		document.getElementById('pia').style.display = 'none';
}

function show_tia()
{
	if(document.getElementById('display_tia').checked == true)
		document.getElementById('tia').style.display = 'block';
	else
		document.getElementById('tia').style.display = 'none';
}

function debug_line(decolor, color)
{
	c = document.getElementById('p' + color);
	d = document.getElementById('p' + decolor);
	for(var i=1; i<=4; i++)
	{
		if(color != -1)
			c.cells[i].style.backgroundColor = "yellow";
		if(d)
			d.cells[i].style.backgroundColor = "transparent";
	}
}

function set_breakpoint(row, pos)
{
	if(row.style.backgroundColor == "red")
	{
		row.style.backgroundColor = "transparent";
		document.getElementById('JAtari').removeBreakpoint(pos);
	}
	else
	{
		row.style.backgroundColor = "red";
		document.getElementById('JAtari').addBreakpoint(pos);
	}
}

</script>

</head>
<body>
<p><applet id="JAtari" code="JAtari" codebase="classes/" width=320 
           height=192 mayscript></applet></p>

<!-- Debuggers -->
<p><b>Debuggers:</b>&nbsp;
	<input type="checkbox" id="display_cpu" onclick="show_cpu()">MOS 6507
	<input type="checkbox" id="display_tia" onclick="show_tia()">TIA 1A
	<input type="checkbox" id="display_pia" onclick="show_pia()">PIA 6532
	<input type="checkbox" id="display_memory" onclick="show_memory()">Memory
</p>
<p>
	<input id="run" type="button" value="Run" onclick="document.getElementById('JAtari').runButton();">
	<input id="step" type="button" value="Step" onclick="document.getElementById('JAtari').stepButton();">
	<input id="next_scanline" type="button" value="Next Scanline" onclick="document.getElementById('JAtari').nextScanlineButton();">
	<input id="next_frame" type="button" value="Next Frame" onclick="document.getElementById('JAtari').nextFrameButton();">
</p>

<!-- CPU Debugger -->
<div id="cpu" style="display: none;">
	<hr>
	<p>Initial position: $<input id="cpu_pos" type="text" size=4 maxlength=4 value="0000" onchange="document.getElementById('JAtari').cpuPosChanged(this.value)"></p>
	<div id="cpu_table"></div>
</div>

<!-- TIA Debugger -->
<div id="tia" style="display: none;">
	<hr>
	<div id="tia_table"></div>
</div>

<!-- PIA Debugger -->
<div id="pia" style="display: none;">
	<hr>
	<div id="pia_table"></div>
</div>

<!-- Memory Debugger -->
<div id="memory" style="display: none;">
	<hr>
	<p>Initial position: $<input id="memory_pos" type="text" size=4 maxlength=4 value="0000" onchange="document.getElementById('JAtari').memoryPosChanged(this.value)"></p>
	<div id="memory_table"></div>
</div>

</body>
</html>
